package com.yili.oa.dao;

import com.yili.oa.models.RankingList;
import com.yili.oa.models.RankingListExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface RankingListMapper {
    @SelectProvider(type=RankingListSqlProvider.class, method="countByExample")
    long countByExample(RankingListExample example);

    @DeleteProvider(type=RankingListSqlProvider.class, method="deleteByExample")
    int deleteByExample(RankingListExample example);

    @Delete({
        "delete from t_ranking_list",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into t_ranking_list (id, name, ",
        "amount, type, user_id)",
        "values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, ",
        "#{amount,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR})"
    })
    int insert(RankingList record);

    @InsertProvider(type=RankingListSqlProvider.class, method="insertSelective")
    int insertSelective(RankingList record);

    @SelectProvider(type=RankingListSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR)
    })
    List<RankingList> selectByExample(RankingListExample example);

    @Select({
        "select",
        "id, name, amount, type, user_id",
        "from t_ranking_list",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR)
    })
    RankingList selectByPrimaryKey(Long id);

    @UpdateProvider(type=RankingListSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") RankingList record, @Param("example") RankingListExample example);

    @UpdateProvider(type=RankingListSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") RankingList record, @Param("example") RankingListExample example);

    @UpdateProvider(type=RankingListSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(RankingList record);

    @Update({
        "update t_ranking_list",
        "set name = #{name,jdbcType=VARCHAR},",
          "amount = #{amount,jdbcType=DECIMAL},",
          "type = #{type,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(RankingList record);
}